/**
 * 公共api
 */

import { commonRequest } from '@/api/commonHttp';
// 获取登录用户信息
export const queryLoginUserInfoService = (data, loadingFn) => commonRequest({
  url: '/sysback/login/getLoginInfo',
  type: 'post',
  data,
  loadingFn
});

// 获取OA跳转地址
export const queryOAUrlService = (data, loadingFn) => commonRequest({
  url: `/sysback/oa/getAuditPageUrl?oaRequestId=${data.oaRequestId}`,
  type: 'post',
  data,
  loadingFn
});

// 获取Hr区域
export const queryAreaListService = (data, loadingFn) => commonRequest({
  url: '/sysback/item/search',
  type: 'get',
  data,
  loadingFn
});

// 获取业务区域
export const queryBusinessAreaListService = (data, loadingFn) => commonRequest({
  url: '/sysback/supplyinfofromsrcm/getAllAreaFromScrm',
  type: 'post',
  data,
  loadingFn
});

// 归属部门
export const queryBelongDepartmentService = (data, loadingFn) => commonRequest({
  url: '/sysback/product/rawMaterial/queryDropdownItemList',
  type: 'post',
  data,
  loadingFn
});

// 获取品牌
export const queryBrandListService = (data, loadingFn) => commonRequest({
  url: '/sysback/productbrand/productbrand/getAllBrands',
  type: 'get',
  data,
  loadingFn
});

// 获取公司列表
export const queryAllCompanyService = (data, loadingFn) => commonRequest({
  url: '/sysback/apiItemRest/getAllCompany',
  type: 'get',
  data,
  loadingFn
});

// 获取所有品类
export const queryAllCategoryService = (data, loadingFn) => commonRequest({
  url: '/sysback/category/productplatformcategory/getProductCategoryTree',
  type: 'get',
  data,
  loadingFn
});

// 通过名称及编码获取品类
export const queryCategoryByNoOrNameService = (data, loadingFn) => commonRequest({
  url: `/sysback/choose/category/searchCategoryList?categoryNo=${data.categoryNo}&categoryName=${data.categoryName}`,
  type: 'post',
  data,
  loadingFn
});

// 关联分类 - 分类树查询
export const getByParentUuidsService = (data, loadingFn, target) => commonRequest({
  url: '/sysback/choose/category/getByParentUuids',
  type: 'post',
  data,
  loadingFn,
  target
})

// 获取归属中心
export const queryAllCenterService = (data, loadingFn) => commonRequest({
  url: '/sysback/product/limit/getAllCenters',
  type: 'get',
  data,
  loadingFn
});

// 查询公司下拉框列表
export const queryCompanyItemListService = (data, loadingFn) => commonRequest({
  url: '/sysback/cpfrStockManager/queryCompanyItemList',
  type: 'get',
  data,
  loadingFn
});

// 查询品牌下拉框列表
export const queryBrandItemListService = (data, loadingFn) => commonRequest({
  url: '/sysback/cpfrStockManager/queryBrandItemList',
  type: 'get',
  data,
  loadingFn
});

// 查询中心和部门下拉框列表
export const queryOrgItemListService = (data, loadingFn) => commonRequest({
  url: '/sysback/cpfrStockManager/queryOrgItemList',
  type: 'get',
  data,
  loadingFn
});

// 查询仓位下拉框列表
export const queryStockItemListService = (data, loadingFn) => commonRequest({
  url: '/sysback/cpfrStockManager/queryStockItemList',
  type: 'get',
  data,
  loadingFn
});

// 查询归属中心下拉框列表
export const getCenterItemListService = (data, loadingFn) => commonRequest({
  url: '/sysback/cpfrStockManager/getCenterItemList',
  type: 'get',
  data,
  loadingFn
});

// 通过名称及编码获取品类（只查四级类）
export const getCategoryListByKeyService = (data, loadingFn) => commonRequest({
  url: '/sysback/choose/category/getCategoryListByKey',
  type: 'post',
  data,
  loadingFn,
  isFormData: true
});

// 品类 - 预测品类 通过商品名称 规格 品牌
export const getCategoryPredictionsService = (data, loadingFn) => commonRequest({
  url: '/sysback/choose/category/getCategoryPredictions',
  type: 'post',
  data,
  loadingFn,
});
// 设置智能搜索品类埋点
export const setCategoryPredictionsTrackService = (data, loadingFn) => commonRequest({
  url: '/sysback/product/sku/log/saveCategoryPredictions',
  type: 'post',
  data,
  loadingFn,
});

// 品类 - 查询一级类
export const getLevelOneCategoryListService = (data, loadingFn) => commonRequest({
  url: '/sysback/choose/category/getLevelOneCategoryList',
  type: 'post',
  data,
  loadingFn,
  isFormData: true
});

// 品类 - 查询分类 - 根据父级品类id
export const getCategoryByParentUuidService = (data, loadingFn) => commonRequest({
  url: '/sysback/choose/category/getByParentUuid',
  type: 'post',
  data,
  loadingFn,
  isFormData: true
});

// 根据品牌名称查询品牌/系列（关联品类品牌页面）
export const getBrandSeriesByBrandNameService = (data, loadingFn) => commonRequest({
  url: '/sysback/brandseries/getBrandSeriesByBrandName',
  type: 'post',
  data,
  loadingFn,
  isFormData: true
})

// 根据系列名称查询品牌/系列（集团/区域加价率查询条件-系列）
export const getBrandSeriesBySeriesNameService = (data, loadingFn) => commonRequest({
  url: '/sysback/brandseries/getBrandSeriesBySeriesName',
  type: 'post',
  data,
  loadingFn,
  isFormData: true
})

// 商品中心 - 修改表单管理 - 单据表尾字段信息获取
export const get4FormDetailService = (data, loadingFn) => commonRequest({
  url: '/sysback/product/update/record/get4FormDetail',
  type: 'post',
  data,
  isFormData: true,
  loadingFn
})

// 价格中心 - 修改售价 - 获取区域信息
export const queryAreaInfoService = (data, loadingFn) => commonRequest({
  url: '/sysback/salePrice/secondPhase/queryAreaInfo',
  type: 'get',
  data,
  loadingFn
})

// 查询页面是否可操作状态
export const operationSwitchSearchService = (data, loadingFn) => commonRequest({
  url: '/sysback/operationSwitch/search',
  type: 'get',
  data,
  loadingFn
})

// 获取销售区域及售卖平台
export const querySalePlatAndSaleAreasService = (data, loadingFn) => commonRequest({
  url: '/sysback/product/collect/getSalePlatAndSaleAreas',
  type: 'get',
  data,
  loadingFn
});

// 根据供应商获取供货城市
export const getSupplyProvinceBySupplyNoService = (data, loadingFn) => commonRequest({
  url: '/sysback/supplyinfofromsrcm/getSupplyProvinceBySupplyNo',
  type: 'post',
  data,
  loadingFn,
  isFormData: true
});

// 查询登录人销售区域信息
export const queryLoginUserSaleAreaService = (data, loadingFn) => commonRequest({
  url: '/sysback/deleteSaleArea/queryLoginUserSaleArea',
  type: 'post',
  data,
  loadingFn
})

// 查询所有等级的分类
export const searchDialogCategoryService = (data, loadingFn) => commonRequest({
  url: '/sysback/product/category/label/rel/searchDialogCategory',
  type: 'post',
  data,
  loadingFn
})

// 高级关联查询品类
export const cateLabelSeniorSearchService = (data, loadingFn) => commonRequest({
  url: '/sysback/product/category/label/rel/seniorSearch',
  type: 'post',
  data,
  loadingFn
})

// 获取品类标签树集合
export const cateLabelQueryTreeDataService = (data, loadingFn) => commonRequest({
  url: '/sysback/product/category/label/queryTreeData',
  type: 'get',
  data,
  loadingFn
})

// 查询已关联品类标签树集合
export const queryLabelByCategoryUuidService = (data, loadingFn) => commonRequest({
  url: '/sysback/product/category/label/rel/queryLabelByCategoryUuid',
  type: 'get',
  data,
  loadingFn
})

// 集团指导加价率 | 区域标准加价率 修改日志记录查询
export const secondPhaseTaskDetailSearchService = (data, loadingFn) => commonRequest({
  url: '/sysback/salePrice/secondPhase/taskDetail/search',
  type: 'post',
  data,
  loadingFn
})

// 根据属性ID查询详情
export const getDetailedListByAttrUuidService = (data, loadingFn) => commonRequest({
  url: '/sysback/template/producttmplateattrandvalue/getDetailedListByAttrUuid',
  type: 'get',
  data,
  loadingFn
})

// 商品名称下拉集合查询
export const getProductNamesService = (data, loadingFn) => commonRequest({
  url: '/sysback/product/potential/getProductNames',
  type: 'get',
  data,
  loadingFn
})

// 新增/编辑线索商品-根据品牌查询系列
export const getSeriesByBrandUuidService = (data, loadingFn) => commonRequest({
  url: '/sysback/brandseries/getSeriesByBrandUuid',
  type: 'post',
  data,
  loadingFn,
  isFormData: true
})

// 查询管理区域集合
export const manageAreaSearchService = (data, loadingFn) => commonRequest({
  url: '/sysback/manageArea/search',
  type: 'get',
  data,
  loadingFn
})

// 商品图文获取历史数据
export const saveOrSubmitImageInfoService = (data, loadingFn) => commonRequest({
  url: '/sysback/tempSkuImage/saveOrSubmit',
  type: 'post',
  data,
  loadingFn
})

// 根据商品大类商品图文提交或保存
export const queryImageInfoService = (data, loadingFn) => commonRequest({
  url: '/sysback/tempSkuImage/getBySku',
  type: 'get',
  data,
  loadingFn
})

// 关联四级类的高级查询接口
export const getFullPathByUuidsService = (data, loadingFn) => commonRequest({
  url: '/sysback/category/productplatformcategory/getFullPathByUuids',
  type: 'post',
  data,
  loadingFn
})
